package com.dsteiner.widgets.client.domain;

import java.util.HashMap;
import java.util.Map;

import com.dsteiner.widgets.client.ObjectUtil;

public class ResultSet{
	
	private Object data;
	private Map<String, Object> criterias = new HashMap<String, Object>();
	public ResultSet() {
	}
	public ResultSet(ResultSet resultSet) {
		this.data = resultSet.data;
		this.criterias.putAll(resultSet.criterias);
	}
	public boolean equals(Object obj) {
		if (obj == null)
			return false;
		if (!(obj instanceof ResultSet))
			return false;
		ResultSet other = (ResultSet) obj;
		return ObjectUtil.equals(other.criterias, criterias);
	}
	public Map<String, Object> getCriterias() {
		return criterias;
	}
	public Object getData() {
		return data;
	}
	public void setCriteria(String name, Object criteria) {
		if(criteria != null)
			criterias.put(name, criteria);
		else
			criterias.remove(name);
	}
	public void setCriterias(Map<String, Object> criterias) {
		this.criterias = criterias;
	}
	public void setData(Object data) {
		this.data = data;
	}
	public Object getCriteria(String name) {
		return criterias.get(name);
	}
}